<?php
require_once('lib_load.php');
load_lib(array('DbMysql', 'Chat'));
$chat = new Chat();
//Different behaviour, based on action POST parameter
//TODO: perhaps, need to be more accurate with post vars
switch ($HTTP_POST_VARS['action']) {
    case 'last':
        echo $chat->GetLastMessageID();
        break;
    case 'new_reply':
        $chat->NewReply($HTTP_POST_VARS['nick'], $HTTP_POST_VARS['line']);
        break;
    default:
        $chat->Refresh($HTTP_POST_VARS['last']);
}
?>
